home *** CD-ROM | disk | FTP | other *** search
/ AP Professional Graphics CD-ROM Library / AP Professional Graphics CD-ROM Library.iso / pc / unix / appendix / errata1.txt next >
Encoding:
Text File  |  1994-12-12  |  11.8 KB  |  334 lines

  1. Errata to _Graphics Gems_, first edition, edited by Andrew Glassner
  2. (glassner.pa@xerox.com), Academic Press 1990.  Code available online in
  3. princeton.edu:pub/Graphics/GraphicsGems/Gems.
  4.  
  5. compiled by Eric Haines (erich@eye.com) from author and reader contributions
  6.  
  7. version 1.11
  8. date:  12/12/94
  9.  
  10. -----
  11.  
  12. Errors in the text:
  13.  
  14. p. 3, bottom:  The equation "N . P + c = 0" is better expressed as
  15.     "N . P - c = 0" in order to match Figure 1a.
  16.  
  17. p. 5, V2 Perpendicular:  change "N <- (-Vx, Vy)" to "N <- (-Vy, Vx)"
  18.  
  19. p. 5, V2 Reflect:  change "N <- (-Vy, -Vx)" to "N <- (-Vx, -Vy)"
  20.  
  21. p. 105, last sentence of first paragraph:  "ajacent" to "adjacent".
  22.  
  23. p. 216, caption for figure 2:  "54" should read "45" to be consistent with
  24.     the figure (error in two places in caption).
  25.  
  26. p. 365, last line:  "Kajia" to "Kajiya".
  27.  
  28. p. 395, first paragraph:  change "discussed by Haines (1989)" to "discussed by
  29.     Haines in Glassner (1989)".
  30.  
  31. p. 448, last sentence of second paragraph:  change "and now nearly as simple"
  32.     to "and not nearly as simple".
  33.  
  34. p. 463, second to last line:  change "then alpha <- alpha + pi/2" to "then
  35.     alpha <- pi - alpha".
  36.  
  37. p. 495, equation 5:  this should have an equal sign (=) before the
  38.     plus-or-minus (+/-).
  39.  
  40. p. 499, middle of page:  change "and i,j,K" to "and i,j,k".
  41.  
  42. p. 503, last sentence:  change "Let P' = Rot_(alpha, N) ..." to "Let P' =
  43.     Rot_(theta, N) ...".
  44.  
  45. p. 516, last paragraph:  a reader notes an additional reference which
  46.     predates Berger and Salmon & Slater, namely "The Viewing Transformation,"
  47.     Technical Memo. no. 84, Alvy Ray Smith, Computer Graphics Project,
  48.     Lucasfilm, June 24, 1983 (rev. May 4, 1984).
  49.  
  50. p. 602, second paragraph:  the matrix Tij should be:
  51.     [ 1  0  0  0  ]
  52.     [ 0 1/2 0  0  ]
  53.     [ 0  0 1/4 0  ]
  54.     [ 0  0  0 1/8 ]
  55.  
  56. p. 610:  the binomial "( n-i [over] j )" should be "( n-1 [over] j )".  This
  57.     error appears on the fifth line of the long derivation and within the
  58.     Zi,j definition.
  59.  
  60. p. 809:  the author of "Approximation of Sweep Surfaces by Tensor Product
  61.     B-Splines" is M. (not J.) Bloomenthal.  The author is correctly
  62.     attributed in the text (page 569).
  63.  
  64. p. 814: 5th line from bottom. "Knuth 1981" should read "Knuth 1981b" and
  65.     "Vol. 2" should read "Vol. 1".  The reference above this should be
  66.     "Knuth 1981a".
  67.  
  68. p. 820, 9th line from bottom:  "D.P. Greenburg" should be "D.P. Greenberg".
  69.  
  70. -----
  71.  
  72. The following are errors in the code listings (corrected in the online code at
  73. princeton.edu:pub/Graphics/GraphicsGems/Gems).
  74.  
  75. Serious errors (ones your compiler cannot or may not catch):
  76.  
  77. p. 630: Delete FLOOR and CEILING macros (they're more like truncations).
  78.     Change ROUND macro to (i.e. add parentheses around "a"):
  79.     #define ROUND(a)    ((a)>0 ? (int)((a)+0.5) : -(int)(0.5-(a)))
  80.     Change SGN macro to (i.e. change positive condition result to "1"):
  81.     #define SGN(a)        (((a)<0) ? -1 : 1)
  82.  
  83. p. 632:  procedure declarations for routines in the "2D and 2D Vector C
  84.      Library" (next pages) are missing from "GraphicsGems.h", e.g.
  85.         
  86.         double V2SquaredLength() ;
  87.         double V2Length() ;
  88.         Vector2 *V2Negate() ;
  89.         ...
  90.  
  91. p. 638, third line from bottom:  in V3Combine change last "result->y" to
  92.     "result->z"
  93.  
  94. p. 640:  V3MulPointByMatrix() does not work.  A separate local Point3 (e.g.
  95.     "Point3 q ;") should be used in place of "p" for assignment and then
  96.     passed back.
  97.  
  98. p. 649, top:  add "#include <math.h>"
  99.  
  100. p. 662, line 10:  add "#include <math.h>"
  101. p. 665, line 1:  change "FLOOR(...)" to "(floor((double)(...))".
  102.  
  103. p. 663, line 45:  change first "+" to "="; should read
  104.               "VnextLeft = (Vleft=VnextLeft) + 1;"
  105.  
  106. p. 667, line 6:  change "POLY_NMAX 8" to "POLY_NMAX 10" (for triangles and
  107.     quadrilaterals).  Six clipping planes used on convex polygons gives
  108.     +6 potential extra vertices generated.
  109.  
  110. p. 670-673, throughout:  change "int mask" declarations to "unsigned long
  111.     mask" declarations.  This avoids an infinite loop occuring when the
  112.     highest bit is set.
  113.  
  114. p. 676, line 11:  add the line "up = (double *)u;"
  115.  
  116. p. 671, line 1:  add at top of page the following test (or make sure the
  117.     Poly_vert structure has <= 32 doubles at compilation time):
  118.  
  119.     if (sizeof(Poly_vert)/sizeof(double) > 32) {
  120.     fprintf(stderr, "Poly_vert structure too big; must be <=32 doubles\n");
  121.     exit(1);
  122.     }
  123.  
  124. p. 687, line 8:  Identical points cause two points to be drawn.  Between the
  125.     first two plot() commands, add the line:
  126.  
  127.     if ( pixels_left < 0 ) return ;
  128.  
  129. p. 714, line 20:  the last "1" in "if (i + 1 < l * 1)" should be an "l"
  130.  
  131. p. 716, line 27:  missing "/" at end of comment (if not fixed, code compiles
  132.           but is wrong)
  133.  
  134. p. 720, lines 3 and 6 from bottom:  change "m+1>>1" to "(m+1)>>1" to establish
  135.           correct evaluation order.
  136.  
  137. p. 737, lines 19-24, from "if ((quadrant..." to "}", should read (and note
  138.     corrected indentations on "else" statement):
  139.  
  140.                         if (coord[i] < minB[i] || coord[i] > maxB[i])
  141.                                 return (FALSE);
  142.                 } else {
  143.                         coord[i] = candidatePlane[i];
  144.                 }
  145.  
  146. p. 745, throughout:  delete references to "lx", which is set but not used
  147.  
  148. p. 748, line 22:  change "negetive" to "negative"
  149.  
  150. p. 753, line 35:  change "int n1, n2," to "int n1=0, n2=0," so that first
  151.           fprintf() error message has defined values
  152.  
  153. p. 756, line 15:  "unsigned int *fi=&f;" to
  154.           "unsigned int *fi = (unsigned int *) &f;" for type
  155.           consistency, and some compilers think "=&" means "&="
  156. p. 766, top:  add '#include "GraphicsGems.h"' and '#include <math.h>'
  157.     line 25:  change "det = det4x4( out );" to "det = det4x4( in );"
  158.         throughout:  change "matrix4" to "Matrix4"
  159.  
  160. p. 774, line 5:  change "theta," to "theta = 0,"
  161.  
  162. p. 799, bottom and p. 800, line 11:  add this pair of lines between
  163.     "DrawBezierCurve(...);" and "return;":
  164.         free((void *)u);
  165.         free((void *)bezCurve);
  166.     Also, see errata note at end of this file.
  167. p. 800, line 19:  add this pair of lines before "tHatCenter = ...":
  168.         free((void *)u);
  169.         free((void *)bezCurve);
  170.  
  171.  
  172. Syntax errors (ones your compiler or lint will catch):
  173.  
  174. p. 633-642, throughout:  replace "};" with "}" to make lint happy
  175. p. 640, gcd():  the variable "k" is set but not used - remove it
  176.  
  177. p. 649, line 31:  change "LengthVector3" to "V3Length"
  178. p. 650, line 1:  bad end-of comment; delete "/"
  179.  
  180. p. 651, throughout:  Can't use "const" as a variable name, as it is a reserved
  181.              word in ANSI C.  Use "liconst" instead.
  182.  
  183. p. 657, 659:  make "nicenum" declarations match, i.e. use either "double
  184.         nicenum()" or "static double nicenum()" for both occurrences
  185. p. 659:  change "exp" to "expv", since "exp()" is a math library function.
  186.  
  187. p. 660, line 11:  header missing end of comment "*/"
  188.  
  189. p. 662, line 13:  change "SYBYRES" to "SUBYRES"
  190.         line 16:  bad space after "MODRES"
  191.         line 42:  change "XRmax" to "xRmax"
  192. p. 665, line 15:  missing semicolon after "int area"
  193.         line 27:  change "O" to "0" in "if (partialArea>O)"
  194. p. 666, line 13:  change "O" to "0" in "rightMask = O;"
  195.  
  196. p. 670, top:  add to make lint happy
  197.         static scanline();
  198.         static incrementalize_y();
  199.         static incrementalize_x();
  200.         static increment();
  201. p. 671, line 35:  missing "{" at end of "while (y<ly && y<ry)"
  202. p. 671-2, throughout:  add "(double *)" castings to all "incrementalize*"
  203.         calls to make lint happy
  204. p. 676, line 8:  change "if (tu<=0. ^ tv<=0.) {" to
  205.         "if ( (tu<=0.) ^ (tv<=0.) ) {" to avoid precedence confusion
  206.     end:  change "void pixelproc();" to "static void pixelproc();"
  207.  
  208. p. 681, throughout:  "y0" and "y1" are Bessel functions in the math library,
  209.         so lint complains; ignore complaint or rename
  210.  
  211. p. 684:  change "delete" to "cdelete" and "insert" to "cinsert", since these
  212.         routine names are already used by dbm database manager
  213.  
  214. p. 687, near end:  change "+ =" to "+="
  215.  
  216. p. 696, line 8:  add '#include "GraphicsGems.h"'
  217. p. 700, line 5:  add '#include "GraphicsGems.h"'
  218. p. 702-706:  change "max" to "MAX", "min" to "MIN"
  219. p. 705, line 18:  delete "*sp", as it is not used
  220. p. 706, end:  add '#include "GraphicsGems.h"'
  221. p. 707, in clip:  delete "*sp", as it is not used
  222. p. 709, line 23:  missing semicolon at end of "up = (up) ? FALSE : TRUE"
  223. p. 710, top:  change "max" to "MAX", "min" to "MIN"
  224.  
  225. p. 713, line 26:  change ":" to ";" in "char **argv:"
  226.  
  227. p. 715, top:  pseudo-code at head of file (to advance from one element to the
  228.             next) should be commented out.
  229.         line 14:  missing declaration "int randmasks[32];"
  230.     throughout:  three calls to "bitwidth()" need to cast argument to
  231.         "(unsigned int)" to make lint happy
  232.  
  233. p. 719:  add "#include <string.h>" (or strings.h)
  234.  
  235. p. 727, line 11:  remove ")" in "static double bigC,..." line
  236. p. 728, lines 21-23:  change "cal_q_msq" to "calc_q_msq"
  237.     lines 23,42:  change "NULL" to "(double *)NULL" to make lint happy
  238.         line 26:  change "con_const" to "cone_const" in
  239.               "bigC = m1sq + con_const * q1"
  240.     last line:  add a "}" to end albers_project procedure
  241.  
  242. p. 730:  missing inclusion of GraphicsGems.h.
  243.  
  244. p. 734, line 4:  change "exit();" to "exit(1);"
  245.  
  246. p. 736, line 20:  change "O" to "0" in "for (i=O;"
  247.  
  248. p. 739, line 12:  change "else if (D > 0)" to "else", since at this point
  249.         D must be greater than 0; makes lint happy
  250.  
  251. p. 757, line 4:  change "{" to "[" in "sqrttab{"
  252.     line 14:  change "= &n" to "= (unsigned int *)&n"
  253.     line 21:  change "*num & = 0x7fffff:" to "*num &= 0x7fffff;" to fit
  254.           ANSI C, and to fix error of ":" at end of line.
  255.     line 22:  change "| =" to "|="
  256.     line 27:  change ":" to ";"
  257.  
  258. p. 765, line 20,22:  change "Matrix" to "Matrix4"
  259.  
  260. p. 766, line 29:  change "exit();" to "exit(1);"
  261.  
  262. p. 774, line 2:  missing ";" at end of "long *argx, *argy"
  263.  
  264. p. 775:  P, Q, and M need to be declared as externs
  265.  
  266. p. 780, line 18:  bad start of comment for "/ re-parameterization"
  267.  
  268. p. 785, line 1:  bad start-of-comment
  269.  
  270. p. 789, lines 7,25:  change both "NULL" to "(Point2 *)NULL" to make lint happy
  271.         in ConvertToBezierForm:  "t" is not used, can be deleted
  272. p. 791, line 24:  remove "break;" after "return 0;"; unnecessary
  273. p. 793, ControlPolygonFlatEnough:  "t" is not used, can be deleted
  274. p. 795, ComputeXIntercept:  "T" and "Y" do not have to be computed, since
  275.         the result "Y" is not returned.  Note that there are many
  276.         operations in this routine that are unnecessary (e.g. "0.0 - 0.0").
  277.  
  278. p. 797-807, throughout:  change "V2ScaleII" to "V2ScaleIII" and "Bezier" to
  279.     "BezierII" in order to avoid name collisions with the code on pages
  280.     787-796 (i.e. the same subroutine names are used in both, but with
  281.     different argument types, etc).  Important only if you link in both
  282.     of these subroutine libraries.
  283.  
  284. -----
  285.  
  286. The following are typographical errors in the comments:
  287.  
  288. p. 687, line 3:  "plottted" to "plotted"
  289.  
  290. p. 701, line 26:  change "interscetion" to "intersection"
  291.  
  292. p. 728, line 10:  "latitute" to "latitude"
  293. p. 729, line 8:  "degress" to "degrees"
  294.  
  295. p. 724, line 38:  "seperated" to "separated"
  296. p. 725, lines 7-9:  "componant" to "component"
  297.  
  298. p. 730, line 17:  "minium" to "minimum"
  299.  
  300. p. 752, line 2:  "positve" to "positive"
  301.  
  302. p. 760, line 5:  "interger" to "integer"
  303. p. 761, line 4:  "preceed" to "precede"
  304.  
  305. p. 766, throughout (5 times):  "determinent" to "determinant"
  306.  
  307. p. 781, lines 7,23:  "demoninator" to "denominator"
  308.  
  309. -----
  310.  
  311. Addenda:  There is additional code for Kelvin Thompson's "Rendering
  312. Anti-Aliased Lines" gem in the online distribution of the code.
  313.  
  314. -----
  315.  
  316. Concerning page 799, Philip Schneider's Bezier code:
  317.  
  318. If you are operating in a dimensional system such that the desired error in
  319. the fitting process is a fraction (e.g., 0.01 inches) rather than a whole
  320. number (e.g., 2.0 pixels), then the line on page 799 reading
  321.  
  322. iterationError = error * error;
  323.  
  324. should be changed to
  325.  
  326. iterationError = ERRFACTOR * error;
  327.  
  328. where ERRFACTOR is #defined to some implementation-dependent value such as
  329. 4.0.  If this is not done, then reparameterization will never occur.  The
  330. result is not an erroneous curve, but a suboptimal one; the algorithm will
  331. always subdivide when the initial fit is too "loose."
  332.  
  333. (from Earl Boebert, boebert@SCTC.COM)
  334.